package controller

import (
	"net/http"
	"server_cluster/common/logger"
	"server_cluster/http/model"

	"github.com/gin-gonic/gin"
)

func (c *Controller) updateUserInfo(ctx *gin.Context) {
	userInfo := new(model.User)
	err := ctx.ShouldBindJSON(userInfo)
	if err != nil {
		logger.Error("parse json error: %v", err)
		ctx.JSON(http.StatusOK, ParamError)
		return
	}
	err = c.s.UpdateUserInfo(userInfo)
	ctx.JSON(http.StatusOK, &model.CommonRsp{Code: 20000, Msg: "success", Data: userInfo})
}
